package com.xuhuan.server.controller;

import com.xuhuan.server.entity.UserVO;
import com.xuhuan.server.mapper.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: 徐欢
 * @date: 2021/9/6 19:44
 * @description:
 */
@RestController()
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping(value = "/query",method = RequestMethod.GET)
    public UserVO queryUser(@RequestParam(value = "id") int id){
        return userService.getById(id);
    }

    @RequestMapping(value = "/save",method = RequestMethod.POST)
    public UserVO saveUser(@RequestBody UserVO userVO){
        return userService.save(userVO);
    }

}
